import 'package:flutter/material.dart';
import 'package:module_discover/pages/filter_domain/filter_domain_logic.dart';

/// 输入框view
class RoundInputField extends StatelessWidget {
  final String hintText;
  final String fieldKey;
  FilterDomainLogic logic;
  final ValueChanged<String>? onChanged;

  RoundInputField({
    super.key,
    required this.fieldKey,
    required this.logic,
    this.hintText = "请输入",
    this.onChanged,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 26,
      decoration: BoxDecoration(
        color: Colors.grey[100],
        borderRadius: BorderRadius.circular(4),
      ),
      margin: const EdgeInsets.symmetric(vertical: 4),
      padding: const EdgeInsets.symmetric(horizontal: 10),
      child: TextField(
        maxLines: null,
        minLines: 1,
        style: TextStyle(color: Colors.black54, fontSize: 12),
        decoration: InputDecoration(
          hintText: hintText,
          hintStyle: TextStyle(
            color: Colors.grey[600], // 文字颜色#666
            fontSize: 10, // 字号与图片比例一致
            height: 1.6, // 行高14 * 1.25=17.5px
          ),
          contentPadding: EdgeInsets.symmetric(vertical: 6),
          border: InputBorder.none,
          isDense: true, // 紧凑模式消除默认间距
        ),
        keyboardType: TextInputType.multiline,
        controller: logic.selectInputVM.getController(fieldKey),
        onChanged: onChanged,
      ),
    );
  }
}
